#ifndef CustomScroll_H
#define CustomScroll_H

#include <QObject>
#include <QWidget>
#include <QTimer>
#include <QTableView>
#include <QPropertyAnimation>
#include <QDateTime>

class CustomScroll : public QWidget
{
    Q_OBJECT
#define SHOW_ROWS 10    //表格固定显示的行数
#define SCROL_WIDTH 10     //滚动条宽度
#define SCROL_CLOLOR QColor(150,150,150,140)
#define SCROL_SHOW_TIME 2000

    typedef enum tagLuiScrollMouseDragInfo {
        MOUSE_RELEASE = 0,          //鼠标 离开
        MOUSE_PRESS = 1,            //鼠标 按下
        MOUSE_PRESS_MOVE = 2,       //鼠标 按下+移动
        MOUSE_RELEASE_MOVE = 3      //鼠标 离开 并 滑动
    }LUI_Scroll_Mouse_Drag_INFO_E;
    LUI_Scroll_Mouse_Drag_INFO_E m_dragFlag;

public:
    explicit CustomScroll(QTableView* table,QWidget *parent = NULL);

public slots:
    void scrollTimeOut();
private:
    bool eventFilter(QObject *obj, QEvent *evt);

    QTimer m_scrollTimer;       //用于控制右侧滚动条的显示
    QTableView *m_table;        //构造函数传入的表格指针
    QScrollBar *m_scrollBar;    //指向表格滚动条
    QPropertyAnimation *animation;  //属性动画，使用动画驱动表格滑动
    int  m_selectRow;
    int  m_srcollH;
};

#endif // CustomScroll_H

